<?php
class RenrenApi extends AbsApi {	
	public function setOauth($oauth_request_token = '', $oauth_request_secret = '') {
		//$this->oauth = new MBOpenTOAuth(API_QQ_AKEY , API_QQ_SKEY, $oauth_request_token, $oauth_request_secret);
	}
	
	//返回由oauth_request_token和oauth_request_secret组成的数组
	public function getRequestToken() {
		//return $this->oauth->getRequestToken(API_QQ_CALLBACK);
		return array(
			'oauth_token' => '',
			'oauth_token_secret' => '',
		);
	}
	
	public function getAuthorizeURL($oauth_request_token, $sign_in = false, $callback = '') {
		//return $this->oauth->getAuthorizeURL($oauth_request_token, $sign_in, $callback);
		return 'https://graph.renren.com/oauth/authorize?client_id='.API_RENREN_KEY.'&response_type=code&redirect_uri='.API_RENREN_CALLBACK;
	}
	
	//调用这个方法时setOauth的两个参数要传递
	public function getAccessToken($oauth_verifier) {
		return $this->oauth->getAccessToken($oauth_verifier);
	}
	
	public function setClient($oauth_access_token, $oauth_access_secret) {
		if(!isset($this->client)) {
			$this->client = new MBApiClient(API_QQ_AKEY, API_QQ_SKEY, $oauth_access_token, $oauth_access_secret);
		}
	}
	
	//调用api函数之前要先调用setClient
	public function api() {
		$args = func_get_args();
		$method = array_shift($args);
		return call_user_func_array(array($this->client, $method), $args);
	}
	
	public function getLogoutUrl() {
		
	}
}
?>